<div class="buttons atbottom">
	<ul>
		<li><a href="javascript:void(0)" class="cancel"><?php __("Xóa")?></a></li>
		<li><a href="javascript:void(0)" class="back unpublish"><?php __("Hủy kích hoạt")?></a></li>
		<li><a href="javascript:void(0)" class="submit publish"><?php __("Kích hoạt")?></a></li>
		<li><a href="<?php echo $html->url(array('plugin' => 'news', 'controller' => 'manage_news', 'action' => 'add') + $params)?>" class="new"><?php __("Thêm mới")?></a></li>
	</ul>
</div>
<!-- buttons.end -->

<!-- table -->
<div class="table">
	<table cellpadding="0" cellspacing="0" id='news_list'>
		<thead>
			<tr>
				<th width='20'><a><?php echo __("#"); ?></a></th>
				<th width='20'><input type="checkbox" id='checkbox-control' control='index'/></th>
				<th><?php echo $paginator->sort(__("Tiêu đề", true), "News.title"); ?></th>
				<th width='160'><?php echo $paginator->sort(__("Danh mục", true), 'I18nCategory.name'); ?></th>
				<th width='60'><?php echo $paginator->sort(__("Kích hoạt", true), 'News.is_published'); ?></th>
				<th width='60'><?php echo $paginator->sort(__("Tin nóng?", true), 'News.special'); ?></th>
				<th width='85'><?php echo $paginator->sort(__("Ngày", true), 'News.news_date'); ?></th>
				<!-- <th width='70'><?php echo $paginator->sort(__("Độ ưu tiên", true), "News.priority"); ?></th>  -->
				<th width='85'><a><?php echo __("Chức năng"); ?></a></th>
			</tr>
		</thead>
		<tbody>
			<?php if(!$pages):?>
			<tr class="row1">
				<td colspan="9" align="center" style="font-weight:bold"><?php echo __("Chưa có dữ liệu.");?></td>
			</tr>
			<?php
			endif;
				$max = $paginator->params['paging']['News']['defaults']['limit'];
				$page = $paginator->params['paging']['News']['page'];
				$start = ($page - 1) * $max;
				$i=0;
				$class = 'altrow';
				$room_type_list = array();
				foreach ($pages as $page):
					$class = $class == "" ? "class='odd'" : "";
					$page_id = $page['News']['id'];
					//$class = "row".($i%2)?"0":"1";
					$i++;
			?>
			<tr <?php echo $class?> page_id="<?php echo $page_id?>">
				<td class="center"><?php echo ($start + $i)?></td>
				<td class="center"><input type="checkbox" class='index' name='checkbox_index[]' value='<?php echo $page_id?>'/></td>
				<td>
					<span class='field_name'><?php echo $page['News']['title']?></span><br/>
					<span class='alias'><?php echo $page['News']['alias']?></span>
					<?php if ($view_options['details']['show_image']):
					$image = $page['News']['image'];
					
					$url = $configs['News']['image']['uri'].$image;
					if ($view_options['thumbnail']['has_thumbnail']) {
						$image = $html->getThumbnailName($image);
						$url = $configs['News']['thumbnail']['uri'].$image;
					}
					?>
					<br/>
					<img src="<?php echo $html->url('/'.$url);?>"/>
					<?php endif;?>
				</td>
				<td align="center">
					<span class='field_category'><?php echo $page['I18nCategory']['name']?></span>
				</td>
				<td align='center'>
					<?php echo ($page['News']['is_published']) ? $html->image('icons/arrow-7.gif', array('alt' => '')) : $html->image('icons/arrow-8.gif', array('alt' => ''))?>
				</td>
				<td align='center'>
					<?php echo ($page['News']['special']) ? $html->image('icons/arrow-7.gif', array('alt' => '')) : $html->image('icons/arrow-8.gif', array('alt' => ''))?>
				</td>
				<td align='center'>
					<?php echo date("s:i:H d-m-Y", strtotime($page['News']['news_date']))?>
				</td>
				<td class='actions'>
					<div class="functions">
						<div class="header"><h4><?php __("Chức năng");?></h4></div>
						<ul>
							<li><a href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'edit', $page_id))?>" class="edit"><?php __("Chỉnh sửa")?></a></li>
							<li><a href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'delete', $page_id))?>" class="delete delete_page" onclick="return confirm('<?php __("Bạn có thật sự muốn xóa trang này?")?>')"><?php __("Xóa")?></a></li>
						</ul>
					</div>
				</td>
			</tr>
			<?php endforeach;?>
		</tbody>
	</table>
</div>
<!-- table.end -->

<!-- paging -->
<div class="paging-wrapper">
<?php echo $this->element('pagination/pagination', array('model' => 'News'));?>
</div>
<!-- paging.end -->

<!-- buttons -->
<div class="buttons atbottom">
	<ul>
		<li><a href="javascript:void(0)" class="cancel"><?php __("Xóa")?></a></li>
		<li><a href="javascript:void(0)" class="back unpublish"><?php __("Hủy kích hoạt")?></a></li>
		<li><a href="javascript:void(0)" class="submit publish"><?php __("Kích hoạt")?></a></li>
		<li><a href="<?php echo $html->url(array('plugin' => 'news', 'controller' => 'manage_news', 'action' => 'add') + $params)?>" class="new"><?php __("Thêm mới")?></a></li>
	</ul>
</div>
<!-- buttons.end -->
